<?php
/*
Template Name: Sitemap
*/
?>

<?php get_header(); ?>

<!-- PRIMARY CONTENT (start) -->
		
<div id="primary">

    <?php if($themeblvd_sidebar == 'left') : ?>
        <?php $wp_query->is_page = true; ?>
        <?php get_sidebar(); ?>
    <?php endif; ?>

    <div id="content">
        <div class="pad">

            <?php the_post(); ?>
            
            <?php themeblvd_breadcrumbs(); ?>

            <?php if( get_post_meta($post->ID, 'themeblvd_pagetitle', true) != 'false' ) : ?>
			<h2 class="page-title"><?php the_title(); ?></h2>
			<?php endif; ?>

            <!-- Page Content -->
            <?php rewind_posts(); ?>
            <?php the_content(); ?>

            <h2><?php _e("Pages", "themeblvd"); ?></h2>

            <ul>
                <?php wp_list_pages('depth=0&sort_column=menu_order&title_li=' ); ?>
            </ul>

            <h2><?php _e("Categories", "themeblvd"); ?></h2>

            <ul>
                <?php wp_list_categories('title_li=&hierarchical=0&show_count=1') ?>
            </ul>

            <h2><?php _e("Posts per category", "themeblvd"); ?></h2>

            <?php $cats = get_categories(); ?>
            <?php foreach ($cats as $cat) : ?>

                <?php query_posts('cat='.$cat->cat_ID); ?>

                    <h3><?php echo $cat->cat_name; ?></h3>

                    <ul>
                        <?php while (have_posts()) : the_post(); ?>
                        <li style="font-weight:normal !important;"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a> - <?php _e('Comments', 'woothemes') ?> (<?php echo $post->comment_count ?>)</li>
                        <?php endwhile;  ?>
                    </ul>

            <?php endforeach; ?>

            <?php edit_post_link( __('Edit Page', 'themeblvd'), '<p>', '</p>' ); ?>

        </div><!-- .pad (end) -->
    </div><!-- #content (end) -->

    <?php if($themeblvd_sidebar == 'right') : ?>
        <?php $wp_query->is_page = true; ?>
        <?php get_sidebar(); ?>
    <?php endif; ?>

<?php get_footer(); ?>